.SUFFIXES: .o .lo .so

CC=@CC@
CP=/bin/cp
CFLAGS=@CFLAGS@ @apache_cflags@
CFLAGS_SHLIB=@CFLAGS_SHLIB@
EGREP=@EGREP@
LD=@LD@
LIBTOOL=EGREP="@EGREP@" @LIBTOOL@ --tag=CXX
LD_SHLIB=@LD_SHLIB@
LIBS_SHLIB=@LIBS_SHLIB@
LDFLAGS=@LDFLAGS@
LDFLAGS_SHLIB=@LDFLAGS_SHLIB@
APACHE_INC=@APACHE_INC@
apache_conf=@apache_conf@
apache_dir=@apache_dir@
apache_libexec=$(DESTDIR)@apache_libexec@
resin_home=$(DESTDIR)@resin_home@
INCLUDES = $(APACHE_INC) -DRESIN_HOME=\"$(resin_home)\" -I../common
C=../common
COMMON_OBJ=$C/stream.lo $C/config.lo $C/memory.lo
OBJ_PICS=mod_caucho.lo $(COMMON_OBJ)

all	: mod_caucho.la

#mod_caucho.so	: mod_caucho.la
#	mv mod_caucho.la mod_caucho.so

mod_caucho.la	: $(OBJ_PICS)
	$(LIBTOOL) --mode=link $(LD_SHLIB) -module -o $@ -avoid-version -rpath $(apache_libexec) $(OBJ_PICS) $(LIBS_SHLIB)

.c.lo	:
	$(LIBTOOL) --mode=compile $(CC) -o $@ -c $(INCLUDES) $(CFLAGS) $<

.c.o	:
	$(CC) -c $(INCLUDES) $(CFLAGS) $<

install	: mod_caucho.la
	$(LIBTOOL) --mode=install $(CP) mod_caucho.la $(apache_libexec)
	- rm -f $(apache_libexec)/mod_caucho.la
	- rm -f $(apache_libexec)/mod_caucho.a
	sh install.sh -conf $(apache_conf) -libexec $(apache_libexec) \
	   -resin_home $(resin_home)

clean	:
	- rm -r *.o *.lo *.la *.so .libs

$(OBJ_PICS)	: Makefile ../common/cse.h
mod_caucho.lo	: Makefile ../common/cse.h

